package com.mall.server.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mall.dubbo.api.CmsSubjectApi;
import com.mall.model.domain.CmsSubject;
import com.mall.model.vo.CommonPage;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CmsSubjectService {

    @DubboReference
    private CmsSubjectApi subjectApi;

    public List<CmsSubject> listAll() {

        List<CmsSubject> subjects = subjectApi.findAll();
        return subjects;
    }

    public CommonPage list(Integer pageNum, Integer pageSize, String keyword) {

        Page<CmsSubject> page = subjectApi.listPage(pageNum, pageSize, keyword);

        return new CommonPage(page);
    }

}
